<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增FTP信息')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-post-add">
			<input name="treeId" type="hidden" id="treeId"/>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">配置名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="configName" id="configName" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">FTP服务器IP：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="serverIp" id="serverIp">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">FTP端口：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="serverPort" id="serverPort">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">FTP账号：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="ftpName" id="ftpName">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">FTP密码：</label>
				<div class="col-sm-8">
					<div class="input-group">
						<input id="ftpPassword" name="ftpPassword" class="form-control" type="password" >
						<span class="input-group-addon" title="FTP密码,鼠标按下显示密码"
							  onmousedown="$('#ftpPassword').attr('type','text')"
							  onmouseup="$('#ftpPassword').attr('type','password')"><i class="fa fa-key"></i></span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">文件目录：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="ftpDir" id="ftpDir" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">是否使用文件结构目录：</label>
				<div class="col-sm-8">
						<label class="radio-box"> <input type="radio" name="muluyn" value="0"/> 使用 </label>
						<label class="radio-box"> <input type="radio" name="muluyn" value="1"/> 不使用</label>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">云平台用户名：</label>
				<div class="col-sm-8">
					<div class="input-group">
						<input name="treeName" onclick="selectFTPTree()" id="treeName" type="text" class="form-control" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "system/post";
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-post-add').serialize());
	        }
	    }

        /**
		 * FTP管理-新增-选择用户列表
         */
        function selectFTPTree() {
            var url = ctx + "system/post/selectUserTree/";
            var options = {
                title: '选择用户',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            $.modal.close(index);
        }

        function testConnect(){
            alert("1");
        }
	</script>
</body>
</html>
